import Api from '../service/Api';

// 渲染banner详情页
export function bannerPage(id) {
  Api.get("/EduPlate/MSGAppIndex/InterfaceJson.asmx/Pic_GetSingle", {
    Pic_ID: id
  }).then((resp) => {
    console.log(resp);
    if (resp && resp.Goodo && resp.Goodo.R) {
      const data = resp.Goodo.R;
      const tpl = `
        <div class="top">
          <p>详情</p>
          <a href='#' class="back"><img src="img/news_public/news_sys.png"> 返回</a>
        </div>
        <div class="centra banner">
          <h4>${data.PicTitle}</h4>
          <p class="title">时间: ${moment(data.SubmitDate, 'YYYY/M/D HH:mm:ss').format('YYYY-MM-DD')}</p>
          <img src="${API.baseUrl+data.PicUrl}"/>
          <p>${data.PicContent.replace("\n", "</p><p>")}</p>
        </div>
      `;
      $(".right").html(tpl);
    }
  })
}
